﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using PSE.Framework.UI.Settings;
using PSE.Framework.Configuration;
using PSE.Updater.Common.Gateway.DataContract;
using PSE.Updater.Client.UI;
using Microsoft.Win32;

namespace PSE.Updater.Application
{
    public class UpdaterApplication : PSE.Framework.UI.Application.SmartClient.Application<ConfigurationObjectType>
    {
        public UpdaterApplication()
        {
            this.ShutdownMode = System.Windows.ShutdownMode.OnExplicitShutdown;
        }

        protected override void OnApplicationStartup(object sender, System.Windows.StartupEventArgs e)
        {
            base.OnApplicationStartup(sender, e);

            Updater.Client.Providers.Updates.Update update = new PSE.Updater.Client.Providers.Updates.Update();
            update.OnClose = () => { this.Shutdown(); };
            update.Initialize();
        }

        protected override bool AuthenticateUser()
        {
            return true;
        }

        protected override PSE.Framework.UI.Application.SmartClient.ApplicationSettings<ConfigurationObjectType> CreateApplicationSettings()
        {
            return new UpdaterApplicationSettings();
        }
    }
}
